﻿<UserControl x:Class="OSTWin.ucMotor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="300" />
            <ColumnDefinition Width="80"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Image Grid.Row="0" Grid.RowSpan="6" Grid.Column="0"  Source="/OSTWin;component/Resources/Frame_N_Motor_Abstract.png"></Image>
        <Grid Grid.Row="0" Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
        <TextBlock Name="MotorState" Grid.Row="0" Text="{Binding Path=State.MotorState, StringFormat=Motor-State: {0}}" FontWeight="Medium"></TextBlock>
        <TextBlock Name="MotorPosition" Grid.Row="1" Text="{Binding Path=State.MotorPosition, StringFormat=Motor-Position: {0} mm}" FontWeight="Medium"></TextBlock>
        </Grid>

        <Button Name="btnInit" Click="btnInit_Click" Grid.Row="1" Grid.Column="1" Content="Initialize"></Button>
        <Grid Grid.Row="2" Grid.Column="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <TextBlock  VerticalAlignment="Center" Grid.Column="0">Drive2 [mm]:</TextBlock>
            <TextBox Name="txtDrive2" Grid.Column="1" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" 
                     FontSize="15" 
                     Text="{Binding Path=State.MotorPosition}"></TextBox>
        </Grid>
        <Button Name="btnDrive2Center" Click="btnDrive2Center_Click" Grid.Row="3" Grid.Column="1" Content="Drive2Center"></Button>
        <Button Name="btnCali" Click="btnCali_Click" Grid.Row="4" Grid.Column="1" Content="Calibrate"></Button>
        <Button Name="btnStop" Click="btnStop_Click" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2"  Content="!!! STOP Motor !!!"></Button>

        <Button Name="btnMoveUp" Click="btnMoveUp_Click" Grid.Row="0" Grid.RowSpan="2" Grid.Column="2" >
            <Image Source="/OSTWin;component/Resources/MoveUp.png"></Image>
        </Button>

        <Button Name="btnDrive2" Grid.Row="2" Grid.Column="2" Click="btnDrive2_Click" Content="Drive"></Button>
        
        <Button Name="btnMoveDown" Click="btnMoveDown_Click" Grid.Row="3" Grid.RowSpan="2" Grid.Column="2" >
            <Image Source="/OSTWin;component/Resources/MoveDown.png"></Image>
        </Button>
    </Grid>
</UserControl>
